<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <link th:href="@{/css/Semantic-UI-CSS-master/semantic.css}" href="../../static/css/Semantic-UI-CSS-master/semantic.css" rel="stylesheet" type="text/css">
    <link th:href="@{/css/main.css}" href="../../static/css/main.css" rel="stylesheet" type="text/css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>Title</title>
    <script th:src="@{/js/jquery-3.4.0.js}" src="../../static/js/jquery-3.4.0.js" type="text/javascript"></script>
    <script th:src="@{/css/Semantic-UI-CSS-master/semantic.js}" src="../../static/css/Semantic-UI-CSS-master/semantic.js" type="text/javascript"></script>
    <script th:src="@{/js/main.js}" src="../../static/js/main.js" type="text/javascript"></script>
</head>
<body>
<nav class="ui inverted attached segment" id="nav">
    <div class="ui container">
        <div class="ui inverted secondary menu">
            <h2 class="ui teal header item">Blog后台</h2>
            <a href="/admin/index" class="item"><i class="home icon"></i> 博客</a>
            <a href="/admin/type" class="item"><i class="idea icon"></i> 分类</a>
            <a href="/admin/tag" class="item active"><i class="tags icon"></i> 标签</a>
            <div class="right menu">
                <div class="ui dropdown item">
                    <div class="text"><img th:src="${#httpSession.getAttribute('admin').getImg}" src="../../static/img/brain.jpg" class="ui avatar image">
                        <span th:text="${#httpSession.getAttribute('admin').getNickname}">梅迪乌斯</span>
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="/admin/logout" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</nav>
<div class="m-container-small m-padded-large">
    <div class="ui container">
        <form action="/admin/insertTag" method="post" class="ui segment form">
            <div class="fields">
                <div class="field">
                    <input type="text" name="tagName">
                </div>
                <div class="field">
                    <button class="ui teal mini basic button">
                        <i class="add icon"></i>增加
                    </button>
                </div>
            </div>
        </form>
        <table class="ui table">
            <thead>
            <tr>
                <th width="195px"></th>
                <th width="390px">分类</th>
                <th width="195px">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="tag:${tagPageInfo.getList()}">
                <td th:text="${tagStat.count}">1</td>
                <td th:text="${tag.name}">生活常识</td>
                <td>
                    <form action="/admin/deleteTag" method="post">
                        <input type="hidden" name="_method" value="delete">
                        <input type="hidden" th:value="${tag.id}" name="tagId">
                        <button class="ui teal mini basic button">
                            <i class="delete icon"></i>删除
                        </button>
                    </form>
                </td>
            </tr>
            </tbody>
            <tfoot>
            <tr class="center aligned">
                <th colspan="3">
                    <div class="ui grid">
                        <div class=" three wide column">
                            <form action="/admin/tag" method="get" th:if="${tagPageInfo.prePage>0}">
                                <button class="ui button mini teal basic item">
                                    首页
                                </button>
                            </form>
                        </div>
                        <div class=" three wide column">
                            <form action="/admin/tag" method="get" th:if="${tagPageInfo.prePage>0}">
                                <input type="hidden" name="pageNum" th:value="${tagPageInfo.prePage}">
                                <button class="ui button mini teal basic item">
                                    上一页
                                </button>
                            </form>
                        </div>
                        <div class=" four wide column" th:text="|第${tagPageInfo.pageNum}页/共${tagPageInfo.pages}页|">
                            当前页/总页数
                        </div>
                        <div class=" three wide column">
                            <form action="/admin/tag" method="get" th:if="${tagPageInfo.nextPage}>1">
                                <input type="hidden" name="pageNum" th:value="${tagPageInfo.nextPage}">
                                <button class="ui button mini teal basic item">
                                    下一页
                                </button>
                            </form>
                        </div>
                        <div class=" three wide column">
                            <form action="/admin/tag" method="get" th:if="${tagPageInfo.pageNum}<${tagPageInfo.pages}">
                                <input type="hidden" name="pageNum" th:value="${tagPageInfo.pages}">
                                <button class="ui button mini teal basic item">
                                    尾页
                                </button>
                            </form>
                        </div>
                    </div>
                </th>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
<script>
    $('.ui.dropdown').dropdown({
        on : 'hover'
    });
</script>
</body>
</html>